﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
namespace JTicket.UI.Extention.IHandler
{
    public class RoleHandler:IHttpHandler
    {


        #region IHttpHandler 成员

        public bool IsReusable
        {
            get { return false; }
        }

        public void ProcessRequest(HttpContext context)
        {

            HttpRequest request = context.Request;
            HttpResponse response = context.Response;
            string val = request.QueryString["Val"].ToString();
 
            int flag = 0;
            List<Model.C_CodeNote> list =
                BLL.C_CodeNote.GetListAllRoles(val);
            response.Write("[");
            flag = list.Count;
            if (flag > 0)
            {
                foreach (var x in list)
                {
                    response.Write(JsonHelper.ObjectToJson(x));
                    if (--flag > 0)
                    {
                        response.Write(",");
                    }
                }
            }
            response.Write("]"); 
        }

        #endregion
    }


     public class  GetListAllByGroupCod:IHttpHandler{

         #region IHttpHandler 成员

         public bool IsReusable
         {
             get { return false; }
         }

         public void ProcessRequest(HttpContext context)
         {
             BLL.C_CodeNote bllCodeNote = new BLL.C_CodeNote();
             bllCodeNote.GetListAllByGroupCod();
         }

         #endregion
     }

     public class GetRoleBussiness : IHttpHandler
     {

         #region IHttpHandler 成员

         public bool IsReusable
         {
             get { return false; }
         }

         public void ProcessRequest(HttpContext context)
         {
             HttpRequest request = context.Request;
             HttpResponse response = context.Response;
             string OperCode = request.QueryString["OperCode"].ToString();
             int flag = 0;
             List<string> list = BLL.M_OperRight.GetRoleListNoCache(OperCode);
             flag = list.Count;
             if (flag > 0)
             {
                 foreach (var x in list)
                 {
                     response.Write(x);
                     if (--flag > 0)
                     {
                         response.Write(",");
                     }
                 }
             }
             else
             {
                 response.Write("");
                 response.End();
             }
             
         }
         #endregion
     }


}
